#include<stdio.h>
int main()
{
    int x,a,b,c,d,y;
    printf("Input x:\n");
    scanf("%d",&x);
    if(x>0)
    {
        x=x;
    }
    else
    {
        x=-x;
    }
    a=x/1000;
    b=(x-a*1000)/100;
    c=x/10%10;
    d=x%10;
    y=d*1000+c*100+b*10+a;
    printf("y=%d\n",y);
    a=y/100;
    b=y%100;
    printf("a=%d,b=%d\n",a,b);
    printf("result=%d\n",a*a+b*b);
    return 0;
}
